package com.net.xpay.stat.task;

import com.net.xpay.common.domain.DailyTaskRecord;
import com.net.xpay.common.enums.systemTask.DailyTaskName;
import com.net.xpay.common.service.DailyTaskService;
import com.net.xpay.common.service.UserAccountMoneyLeftStatService;
import com.net.xpay.common.service.impl.AbstractDailyTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 **/
@Service
@Slf4j
public class UserAccountMoneyLeftStatDailyTask extends AbstractDailyTaskService implements DailyTaskService {

    @Autowired
    private UserAccountMoneyLeftStatService userAccountMoneyLeftStatService;

    @Override
    protected String getDailyTaskName() {
        return DailyTaskName.USER_ACCOUNT_MONEY_LEFT_STAT;
    }

    @Override
    protected boolean doWorkByDayInternal(DailyTaskRecord record) {
        log.warn("start userAccountMoneyLeftStatDailyTask|day={}", record.getDay());
        userAccountMoneyLeftStatService.statAllUserAccountMoneyLeft(record.getDay());
        log.warn("end userAccountMoneyLeftStatDailyTask|day={}", record.getDay());
        return true;
    }

    @Override
    protected int getFirstStartDayDiff() {
        return 1;
    }


}